JavaScript

panelObject.getState Method

Syntax

panelObj.getState();

Description

Get the state of the Panel Object.

Discussion

Gets the 'state' of the Panel object so that it can later be restored. An object is returned. The active Panel in all Panel Navigators is stored as well as the dock state of Panels in Panel Layouts.

The purpose of getting the Panel State is so that you can later restore it using the .setState() method.

//Get a pointer to the Panel Object
var panelObj = {dialog.object}.getPanelObject();

if (panelObj) {
    //Get the current state of the Panel Object
    var state = panelObj.getState();

    //See what's in the 'state' object
    alert($u.o.toJSON(panelObj.getState()));
}

The object returned by getState() has properties similar to the ones shown in the JSON below:

{
    "type": "panelLayout",
    "panels": [
        {
            "type": "panelCard"
        },
        {
            "type": "panelNavigator",
            "panels": [
                {
                    "type": "panelCard"
                },
                {
                    "type": "panelCard"
                }
            ],
            "activePanel": "PANELCARD_2",
            "hasPrevPanel": false,
            "prevPanelIndex": -1,
            "prevPanel": "",
            "hasNextPanel": true,
            "nextPanelIndex": 1,
            "nextPanel": "PANELCARD_3",
            "history": [
                "PANELCARD_2"
            ],
            "historyIndex": 0,
            "hasHistoryBack": false,
            "historyBack": "",
            "hasHistoryForward": false,
            "historyForward": ""
        }
    ],
    "activePanel": "PANELNAVIGATOR_1",
    "firstPanel": "PANELNAVIGATOR_1",
    "lastPanel": "PANELNAVIGATOR_1",
    "flowCollapsed": "",
    "hasPrevPanel": false,
    "prevPanel": "",
    "hasNextPanel": false,
    "nextPanel": "",
    "hasDockPanel": true,
    "beforeDockPanels": [
        "PANELCARD_1"
    ],
    "afterDockPanels": [],
    "dockPanelShown": false,
    "currentDockPanel": ""
}

See Also